<template>
  <div v-if="visible" class="v-empty">
    <el-empty v-bind="$attrs" :description="$attrs.description || '暂无数据'" />
  </div>
</template>

<script>
export default {
  name: 'WEmpty',
  props: {
    list: {
      type: Array
    }
  },
  computed: {
    visible() {
      return typeof this.list === 'undefined' || (Array.isArray(this.list) && this.list.length === 0)
    }
  }
}
</script>

<style scoped lang="scss">
.v-empty {
  ::v-deep .el-empty {
    padding: var(--padding);
    &__image {
      width: var(--size);
    }
  }
}
</style>
